KERNELDIR := /home/eason/linux/IMX6U/linux_kernel/linux_4.1.15_2.1.0_alientek_eason

CURRENT_PATH := $(shell pwd)

target := chrdevbase

obj-m := $(target).o
app := $(target)_app

build: kernel_modules

.PHONY:cp

kernel_modules:
	$(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) modules

cp:
	sudo cp $(target).ko /home/eason/linux/nfs/rootfs/lib/modules/4.1.15 -rf
# sudo cp $(app) /home/eason/linux/nfs/rootfs/lib/modules/4.1.15 -rf

clean:
	#(MAKE) -C $(KERNELDIR) M=$(CURRENT_PATH) clean
	rm -rf $(obj-m)
	rm -rf $(app).ko
	rm -rf $(target).ko
	rm -rf $(target).mod.c
	rm -rf $(target).mod.o
	rm -rf Module.symvers
	rm -rf modules.order
	rm -rf .$(target).o.cmd
	rm -rf .$(target).ko.cmd
	rm -rf .$(target).mod.o.cmd

app:
	arm-linux-gnueabihf-gcc $(app).c -o $(app)

